<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <form action="" method="post">
        <input type="text" name="t1">
        <select name="fuhao" id="">
            <option value="jia">+</option>
            <option value="jian">-</option>
            <option value="chen">X</option>
            <option value="chu">/</option>
        </select>
        <input type="text" name="t2">
        <input type='submit' name='btn' value='='>
        <input type="text" name="m" value="<?php echo $m?>">
    </form>
</body>
<?php

//   $m="";
  if(isset($_POST['btn'])){
    //   echo 'aaa';
    $fh=$_POST['fuhao'];
    $t1=$_POST['t1'];
    $t2=$_POST['t2'];
    if($fh=='+'){
        $m=$t1+$t2;
    }else if($fh=='-'){
        $m=$t1-$t2;
    }else if($fh=='X'){
        $m=$t1*$t2;
    }else if($fh=='/'){
        if($t2==0){
            echo '分母不能为0';
            return false;
        }else{
        $m=$t1/$t2;
        }
    }
  };
?>
</html>